package com.aaa.whj.service.impl;

import com.aaa.whj.dao.IRecordDao;
import com.aaa.whj.entity.Tab_scl_record;
import com.aaa.whj.entity.Tab_topic;
import com.aaa.whj.service.IRecordService;
import com.mysql.jdbc.StringUtils;
import com.util.LayPage;
import com.util.SqlSessionFactoryUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class RecordServiceImpl implements IRecordService {
    SqlSession session= SqlSessionFactoryUtil.getSession();
    IRecordDao recordDao= session.getMapper(IRecordDao.class);
    @Override
    public List<Tab_scl_record> queryAll(String page, String limit) {
        LayPage layPage = new LayPage();
        if(!StringUtils.isNullOrEmpty(page)){
            layPage.setPage(page);
        }
        if(!StringUtils.isNullOrEmpty(limit)){
            layPage.setLimit(Integer.parseInt(limit));

        }

        return this.recordDao.queryAll(layPage);
    }

    @Override
    public long count(Tab_scl_record tabSclRecord) {
        long count = this.recordDao.count(tabSclRecord);

        return count;
    }

    @Override
    public List<Tab_topic> queryTopic(String id) {
/*        LayPage layPage = new LayPage();
        if(!StringUtils.isNullOrEmpty(page)){
            layPage.setPage(page);
        }
        if(!StringUtils.isNullOrEmpty(limit)){
            layPage.setLimit(Integer.parseInt(limit));

        }*/
        return this.recordDao.queryTopic(id);
    }
}
